import os
import sys
msyn_fold=sys.argv[1]
species_name_list=['Tomato','Potato','viarum','lyratum','melongena','Pepper','Golden','Wolfberry','Datura','biflora']


for index,name in enumerate(species_name_list,1):
    genome_fasta=msyn_fold+'/mSynF'+str(index)+'/species.fa'
    pos=msyn_fold+'/mSynF'+str(index)+'/species.gff_pos'
    command='python get_inter_gene_region.py '+pos+' '+genome_fasta+' '+name+'_inter.fa'
    command2='makeblastdb -in '+name+'_inter.fa  -dbtype nucl  -parse_seqids -out ./db/'+name
    # print(command)
    os.system(command)
    os.system(command2)
    command3='blastn -query  ../'+name+'.pav.txt.psedu.fa -out '+name+'_lost.blast -db ./db/'+name+'  -outfmt 6 -evalue 1e-5 -num_threads 60  -num_alignments 50'
    os.system(command3)
    command4='python merge_find_pseudo.py '+msyn_fold+'  '+name+'_lost.blast '+name+'_pseudgene'
    os.system(command4)
    command5='python get_pseud_seg.py ../'+name+'.pav.txt.psedu ./'+name+'_pseudgene '+name+'_pseudgene.seg'
    os.system(command5)